package com.wjmj.balloon.debugger;

import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.actions.ActionFactory;
import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
import org.eclipse.ui.application.ActionBarAdvisor;
import org.eclipse.ui.application.IActionBarConfigurer;

public class ApplicationActionBarAdvisor extends ActionBarAdvisor {

	private IWorkbenchAction helpAction;
	private IWorkbenchAction resetPerspectiveAction;
	private IWorkbenchAction exitAction;
	
    public ApplicationActionBarAdvisor(IActionBarConfigurer configurer) {
        super(configurer);
    }

    protected void makeActions(IWorkbenchWindow window) {
    	helpAction = ActionFactory.ABOUT.create(window);
		register(helpAction);
		
        exitAction = ActionFactory.QUIT.create(window);
        register(exitAction);
        
        resetPerspectiveAction = ActionFactory.RESET_PERSPECTIVE.create(window);
        register(resetPerspectiveAction);
    }

    protected void fillMenuBar(IMenuManager menuBar) {
		MenuManager fileMenu = new MenuManager("&File", IWorkbenchActionConstants.M_FILE);
		MenuManager windowMenu = new MenuManager("&Window", IWorkbenchActionConstants.M_WINDOW);
    	MenuManager helpMenu = new MenuManager("&Help", IWorkbenchActionConstants.M_HELP);
    	menuBar.add(fileMenu);
    	menuBar.add(windowMenu);
    	menuBar.add(helpMenu);
		
		//File
		fileMenu.add(exitAction);
		
		//window
		windowMenu.add(resetPerspectiveAction);
		
		// Help
		helpMenu.add(helpAction);
		
    }
    
}
